﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;

namespace DTC
{
    public partial class UIBase : Form
    {
        public UIBase()
        {
          //  EnableGlass = false;
            InitializeComponent();
        }

        private void UIBase_Load(object sender, EventArgs e)
        {

        }

        #region 消息处理方法集
        private const string topicTitle = "提示";
        private const string warningTitle = "警告";
        private const string errorTitle = "错误";
        private const string successTitle = "成功";
        private const string questionTitle = "请选择";

        /// <summary>
        /// 提示框
        /// </summary>
        /// <param name="message"></param>
        public void ShowTopic(string message)
        {
            MessageBox.Show(message, topicTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        /// <summary>
        /// 警告框
        /// </summary>
        /// <param name="message"></param>
        public void ShowWarning(string message)
        {
            MessageBox.Show(message, warningTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }
        /// <summary>
        /// 错误框
        /// </summary>
        /// <param name="message"></param>
        public void ShowError(string message)
        {
            MessageBox.Show(message, errorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        /// <summary>
        /// 成功框
        /// </summary>
        /// <param name="message"></param>
        public void ShowSucess(string message)
        {
            MessageBox.Show(message, successTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        /// <summary>
        /// 选择框
        /// </summary>
        /// <param name="message"></param>
        public DialogResult ShowQuestion(string message)
        {
            return MessageBox.Show(message, questionTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
        }
        #endregion

        /// <summary>
        /// 将窗体添加到tabcontrol上
        /// </summary>
        /// <param name="form">窗体</param>
        /// <param name="tabItemName">标签的名字</param>
        /// <param name="panelName">页面的名字</param>
        protected void CreateTabControl(Form form, string tabItemName, string panelName, DevComponents.DotNetBar.TabControl tcAllForms)
        {
            TabItem tabItemNew = new TabItem();
            TabControlPanel tabControlPanelNew = new TabControlPanel();
            tabControlPanelNew.Dock = DockStyle.Fill;
            tabControlPanelNew.Name = panelName;
            tabControlPanelNew.TabItem = tabItemNew;
            tabItemNew.AttachedControl = tabControlPanelNew;
            tabItemNew.Name = tabItemName;

            form.FormBorderStyle = FormBorderStyle.None;
            form.TopLevel = false;
            form.Parent = tabControlPanelNew;
            form.Dock = DockStyle.Fill;
            tabControlPanelNew.Controls.Add(form);
            form.Show();
            tabItemNew.Text = tabItemName;
            tcAllForms.Controls.Add(tabControlPanelNew);
            tcAllForms.Tabs.Add(tabItemNew);
            tcAllForms.SelectedTab = tabItemNew;
        }

    }
}
